package com.ethen.ohosandroidlibs.slice;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.arch.SafeIterableMap;
import android.log.Log;
import android.runtime.DefaultTaskExecutor;
import com.ethen.ohosandroidlibs.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;

public class MainAbilitySlice extends AbilitySlice {
    private static final String TAG = "MainAbilitySliceLog";
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);
        test(null,null);
        SafeIterableMap<String ,String> map = new SafeIterableMap<>();
        map.putIfAbsent("kkk","ddd");
        Log.d(TAG,"get size:"+ map.size());

        DefaultTaskExecutor taskExecutor = new DefaultTaskExecutor();
        taskExecutor.executeOnDiskIO(() -> Log.d(TAG,"run in io trhead! id:"+ Thread.currentThread().getId()));

        Log.d(TAG,"in main thread:"+ taskExecutor.isMainThread());
    }

    public void test(@NonNull String str, @Nullable String kkk){

    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
